const pop = {
    state: {
        popParams: {
            name: '',
            posX: 0,
            posY: 0,
            remarks: null,
            disable: false // 为true时用来长驻一个对话框
        }
    },
    mutations: {
        POPPARAMS: (state, popParams) => {
            if (!state.popParams.disable) {
                state.popParams = popParams
            }
        },
        CLOSE: (state) => {
            if (!state.popParams.disable) {
                state.popParams.name = ''
                state.popParams.posX = 0
                state.popParams.posY = 0
                state.popParams.remarks = null
            }
        },
        CLOSEDIS: (state) => {
            state.popParams.name = ''
            state.popParams.posX = 0
            state.popParams.posY = 0
            state.popParams.remarks = null
            state.popParams.disable = false
        }
    },
    actions: {

        popParams: ({ commit }, popParams) => {
            commit('POPPARAMS', popParams)
        },
        closePop: ({ commit }) => {
            commit('CLOSE')
        },
        closePopDisable: ({ commit }) => {
            commit('CLOSEDIS')
        }
    }
}

export default pop
